<?php
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 xoops.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Dirk Herrmann (Alfred)                                            //
// Site: http://www.simple-xoops.de                                          //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //

include_once dirname(dirname(__FILE__))."/include/xoops.php";

//XOOPS-VERSION 2.0.x or 2.2.x or XOOPSCUBE
$xversion = xoops_check_version();
$module_name = basename( dirname(dirname( __FILE__ ))) ;

global $xoopsModule;
$xoops2Module = (!$xoopsModule) ?	 new XoopsModuleHandler($xoopsDB) : $xoopsModule;
$blmodule=$xoops2Module->getByDirName($module_name);

if ($xversion==2 || defined("SXVERSION")) {
  $adminmenu[0]['title'] = _PREFERENCES;
  $adminmenu[0]['link'] = "../system/admin.php?fct=preferences&op=showmod&confcat_id=0&mod=".$blmodule->getVar('mid');
} 

$adminmenu[1]['title'] = _MI_INFO_ADMENU3;
$adminmenu[1]['link']  = "admin/index.php?op=show";
$adminmenu[2]['title'] = _MI_INFO_ADMENU2;
$adminmenu[2]['link']  = "admin/index.php?op=blockcat";
if ($xversion[1]<1 && !defined("SXVERSION")) {
  if ($xversion[1]<0) {
	  //todo
	} else {
    $adminmenu[3]['title'] = _MI_INFO_BLOCKADMIN;
    $adminmenu[3]['link'] = "admin/myblocksadmin.php";
	}
} else {
  $adminmenu[3]['title'] = _MI_INFO_BLOCKADMIN;
  $adminmenu[3]['link'] = "../system/admin.php?fct=blocksadmin&selmod=".$blmodule->getVar('mid');
}
$adminmenu[4]['title'] = _MI_INFO_ADMENU4;
$adminmenu[4]['link']  = "admin/permission.php";

$approve=0;
global $xoopsUser;
$infothisgroups = (is_object($xoopsUser)) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$infoperm_handler = xoops_gethandler('groupperm');

$show_info_perm = $infoperm_handler->getItemIds('InfoPerm', $infothisgroups, $blmodule->getVar('mid'));
if (in_array(81,$show_info_perm) || $xoopsUser->isAdmin()) $approve=1;
if ($approve==1) {
  global $xoopsDB;
	$sql="SELECT count(bakid) as count FROM ".$xoopsDB->prefix($module_name)."_bak";
	$result=$xoopsDB->query($sql);
	if ($result) {
	  list($approved_count) = $xoopsDB->fetchrow($result);
		$approved_count = intval($approved_count);
	} else $approved_count=0;
	$approvetitle = _MI_INFO_ADMENU5;
	if ($approved_count>0) $approvetitle.=' ('.$approved_count.')';
  $adminmenu[5]['title'] = $approvetitle;
  $adminmenu[5]['link']  = "admin/index.php?op=approved";
}
?>